package com.hfh.Thread;

public class PriorityDemo {
    public static void main(String[] args) {
        int priority = Thread.currentThread().getPriority();
        System.out.println(priority);

        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 100; i++) {
                    System.out.println(Thread.currentThread().getName() + ":" + i);
                }
            }
        }, "线程1");

        Thread t2 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 100; i++) {
                    System.out.println(Thread.currentThread().getName() + ":" + i);
                }
            }
        }, "线程2");

        t1.setPriority(6);
        t2.setPriority(7);

        t1.start();
        t2.start();

    }
}